/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI.GerenciarTREF;

import Biblioteca.Library;
import Biblioteca.VerificaErros;
import ClassesUnicas.Pessoa;
import ClassesUnicas.Profissao;
import DAO.DAOPessoa;
import DAO.MySQL.DAOPessoaMySQL;
import java.sql.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import javax.swing.JDialog;
import javax.swing.JFormattedTextField;
import javax.swing.JOptionPane;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;

/**
 * FrameDefault
 *
 * Versao 1.0
 *
 * Data 16/02/2013
 *
 * @author Igor
 */
public class FrameCRUDPessoa extends FramePattern implements InterfaceFrame {

    //Atributos
    private Pessoa pessoa;
    private DAOPessoa pessoaDAO;

    /**
     * Creates new form FrameDefault
     *
     * @param profissao
     * @param dlg
     */
    public FrameCRUDPessoa(Profissao profissao, JDialog dlg) {
        initComponents();

        this.pessoaDAO = new DAOPessoaMySQL();
        super.dlg = dlg;

        Library.reagirEnter(buttonLocalizar);
        Library.reagirEnter(buttonSalvar);
        Library.reagirEnter(buttonLimpar);
        Library.reagirEnter(buttonFechar);

        Library.semCaracterEspecial(textNome);
        
        this.addInternalFrameListener(
                new InternalFrameAdapter() {
                    @Override
                    public void internalFrameClosing(InternalFrameEvent e) {
                        //A operacao esta sendo realizada na classe FramePattern, nao eh necessario realizar nos InternalFrames
                        validarSair = !verificaCamposVaziosSair();
                    }
                }
        );
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panelTitulo = new javax.swing.JPanel();
        labelTitulo = new javax.swing.JLabel();
        labelCamposObrigatorios = new javax.swing.JLabel();
        panelDadosPrincipais = new javax.swing.JPanel();
        labelNome = new javax.swing.JLabel();
        textNome = new javax.swing.JTextField();
        labelSexo = new javax.swing.JLabel();
        comboBoxSexo = new javax.swing.JComboBox();
        formatTextDataNascimento = new javax.swing.JFormattedTextField();
        jLabel1 = new javax.swing.JLabel();
        labelMatricula = new javax.swing.JLabel();
        textMatricula = new javax.swing.JTextField();
        textCPF = new javax.swing.JTextField();
        labelCPF = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        panelBotoes = new javax.swing.JPanel();
        buttonSalvar = new javax.swing.JButton();
        buttonLimpar = new javax.swing.JButton();
        buttonLocalizar = new javax.swing.JButton();
        buttonFechar = new javax.swing.JButton();

        setClosable(true);
        setIconifiable(true);
        setTitle("Cadastro de Paciente");
        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentShown(java.awt.event.ComponentEvent evt) {
                formComponentShown(evt);
            }
        });

        panelTitulo.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        labelTitulo.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        labelTitulo.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        labelTitulo.setText("Tela utilizada para cadastrar e/ou alterar dados de um Paciente");

        labelCamposObrigatorios.setText("Campos marcados com * são obrigatórios");

        javax.swing.GroupLayout panelTituloLayout = new javax.swing.GroupLayout(panelTitulo);
        panelTitulo.setLayout(panelTituloLayout);
        panelTituloLayout.setHorizontalGroup(
            panelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelTituloLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelTitulo)
                    .addComponent(labelCamposObrigatorios))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panelTituloLayout.setVerticalGroup(
            panelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelTituloLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(labelTitulo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(labelCamposObrigatorios))
        );

        panelDadosPrincipais.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "   Dados Principais   ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12), java.awt.Color.black)); // NOI18N

        labelNome.setText("*Nome:");

        labelSexo.setText("Sexo:");

        comboBoxSexo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "<Escolha um item>", "F", "M" }));

        try {
            formatTextDataNascimento.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        formatTextDataNascimento.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                formatTextDataNascimentoFocusLost(evt);
            }
        });

        jLabel1.setText("Data de Nascimento:");

        labelMatricula.setText("Matrícula:");

        labelCPF.setText("*CPF:");

        jLabel2.setFont(new java.awt.Font("Tahoma", 2, 13)); // NOI18N
        jLabel2.setText("Digite o CPF do responsável, caso o");

        jLabel3.setFont(new java.awt.Font("Tahoma", 2, 13)); // NOI18N
        jLabel3.setText("paciente não possua CPF próprio.");

        javax.swing.GroupLayout panelDadosPrincipaisLayout = new javax.swing.GroupLayout(panelDadosPrincipais);
        panelDadosPrincipais.setLayout(panelDadosPrincipaisLayout);
        panelDadosPrincipaisLayout.setHorizontalGroup(
            panelDadosPrincipaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelDadosPrincipaisLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelDadosPrincipaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelDadosPrincipaisLayout.createSequentialGroup()
                        .addGroup(panelDadosPrincipaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelSexo)
                            .addComponent(comboBoxSexo, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelDadosPrincipaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(formatTextDataNascimento)))
                    .addComponent(labelNome)
                    .addComponent(textNome, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelMatricula)
                    .addComponent(textMatricula, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(panelDadosPrincipaisLayout.createSequentialGroup()
                        .addGroup(panelDadosPrincipaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textCPF, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(labelCPF))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelDadosPrincipaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel3))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panelDadosPrincipaisLayout.setVerticalGroup(
            panelDadosPrincipaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelDadosPrincipaisLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelMatricula)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(textMatricula, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(labelNome)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(textNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelDadosPrincipaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelCPF)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelDadosPrincipaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelDadosPrincipaisLayout.createSequentialGroup()
                        .addComponent(textCPF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelDadosPrincipaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(labelSexo)
                            .addComponent(jLabel1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelDadosPrincipaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(comboBoxSexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(formatTextDataNascimento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel3))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        panelBotoes.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        buttonSalvar.setText("Salvar");
        buttonSalvar.setToolTipText("Clique para salvar os dados digitados");
        buttonSalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSalvarActionPerformed(evt);
            }
        });

        buttonLimpar.setText("Limpar");
        buttonLimpar.setToolTipText("Clique para limpar a tela e habilitar um novo registro");
        buttonLimpar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonLimparActionPerformed(evt);
            }
        });

        buttonLocalizar.setText("Localizar");
        buttonLocalizar.setToolTipText("Clique para cadastrar um novo registro");
        buttonLocalizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonLocalizarActionPerformed(evt);
            }
        });

        buttonFechar.setText("Fechar");
        buttonFechar.setToolTipText("Cancela a operação e fecha a janela");
        buttonFechar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonFecharActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelBotoesLayout = new javax.swing.GroupLayout(panelBotoes);
        panelBotoes.setLayout(panelBotoesLayout);
        panelBotoesLayout.setHorizontalGroup(
            panelBotoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBotoesLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(buttonLocalizar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonSalvar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonLimpar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonFechar)
                .addContainerGap())
        );

        panelBotoesLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonFechar, buttonLimpar, buttonLocalizar, buttonSalvar});

        panelBotoesLayout.setVerticalGroup(
            panelBotoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelBotoesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelBotoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonLimpar)
                    .addComponent(buttonSalvar)
                    .addComponent(buttonLocalizar)
                    .addComponent(buttonFechar))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(panelDadosPrincipais, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panelTitulo, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panelBotoes, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelDadosPrincipais, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelBotoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
        // TODO add your handling code here:
        limparCampos();
    }//GEN-LAST:event_formComponentShown

    private void buttonLimparActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonLimparActionPerformed
        // TODO add your handling code here:
        this.pessoa = null;
        limparCampos();
    }//GEN-LAST:event_buttonLimparActionPerformed

    private void buttonSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSalvarActionPerformed
        // TODO add your handling code here:
        String mensagem = "";
        Boolean tudoCerto = true;

        try {
            if (textNome.getText().isEmpty() && tudoCerto) {
                tudoCerto = false;
                JOptionPane.showMessageDialog(null, "Digite um Nome para o paciente!", "Atenção!", JOptionPane.INFORMATION_MESSAGE);
                textNome.grabFocus();
            }

            //Testa data digitada
            if (tudoCerto && !formatTextDataNascimento.getText().equals("  /  /    ") && !Library.validaData(formatTextDataNascimento.getText())) {
                tudoCerto = false;
                JOptionPane.showMessageDialog(null, "Data de Nascimento inválida.", "Atenção!", JOptionPane.ERROR_MESSAGE);
            }

            if (tudoCerto) {
                if (this.pessoa == null) {
                    this.pessoa = new Pessoa();
                    this.pessoa.setIdPessoa(-1);
                }

                this.pessoa.setNome(textNome.getText());
                if (comboBoxSexo.getSelectedIndex() != 0) {
                    this.pessoa.setSexo((String) comboBoxSexo.getSelectedItem());
                }

                //So insere a data se tiver alguma coisa digitada
                if (!formatTextDataNascimento.getText().equals("  /  /    ")) {
                    this.pessoa.setDataNascimento(formatTextDataNascimento.getText());
                }
                
                //So insere a matricula se tiver alguma coisa digitada
                if (!textMatricula.getText().isEmpty()) {
                    this.pessoa.setMatricula(textMatricula.getText());
                }
                
                if (!textCPF.getText().isEmpty()) {
                    this.pessoa.setCpf(textCPF.getText());
                }

                mensagem = this.pessoaDAO.gravaPessoa(this.pessoa);

                if (mensagem.equals("SUCESSO")) {
                    JOptionPane.showMessageDialog(null, "Paciente cadastrado com sucesso!", "Atenção!", JOptionPane.INFORMATION_MESSAGE);
                    this.pessoa = null;
                    limparCampos();
                    if (super.dlg != null) {
                        super.dlg.dispose();
                    }
                } else {
                    JOptionPane.showMessageDialog(null, mensagem, "Atenção!", JOptionPane.INFORMATION_MESSAGE);
                }
            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, VerificaErros.retornaMensagemErro(e), "Erro!", JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_buttonSalvarActionPerformed

    private void buttonFecharActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonFecharActionPerformed
        // TODO add your handling code here:
        super.validarSair = !verificaCamposVaziosSair();
        if (super.dlg == null) {
            super.fecharAplicacao();
        } else {
            super.dlg.dispose();
        }
    }//GEN-LAST:event_buttonFecharActionPerformed

    private void buttonLocalizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonLocalizarActionPerformed
        // TODO add your handling code here:
        try{ 
            Pessoa pes = new Pessoa();
            pes.setIdPessoa(-1);
            JDialog dlg = new JDialog();
            FrameLocalizaPessoa frame = new FrameLocalizaPessoa(pes, dlg);
            Library.criaInternalFrameDentroDialog(dlg, frame);
            if (pes.getIdPessoa() != -1) {
                this.pessoa = this.pessoaDAO.buscaPessoa(pes.getIdPessoa());
                mostraDadosObjeto();
            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, VerificaErros.retornaMensagemErro(e), "Erro!", JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_buttonLocalizarActionPerformed

    private void formatTextDataNascimentoFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_formatTextDataNascimentoFocusLost
        // TODO add your handling code here:
        formatTextDataNascimento.setFocusLostBehavior(JFormattedTextField.COMMIT);
    }//GEN-LAST:event_formatTextDataNascimentoFocusLost

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton buttonFechar;
    private javax.swing.JButton buttonLimpar;
    private javax.swing.JButton buttonLocalizar;
    private javax.swing.JButton buttonSalvar;
    private javax.swing.JComboBox comboBoxSexo;
    private javax.swing.JFormattedTextField formatTextDataNascimento;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel labelCPF;
    private javax.swing.JLabel labelCamposObrigatorios;
    private javax.swing.JLabel labelMatricula;
    private javax.swing.JLabel labelNome;
    private javax.swing.JLabel labelSexo;
    private javax.swing.JLabel labelTitulo;
    private javax.swing.JPanel panelBotoes;
    private javax.swing.JPanel panelDadosPrincipais;
    private javax.swing.JPanel panelTitulo;
    private javax.swing.JTextField textCPF;
    private javax.swing.JTextField textMatricula;
    private javax.swing.JTextField textNome;
    // End of variables declaration//GEN-END:variables

    @Override
    public void limparCampos() {
        Library.limpaTextos(panelDadosPrincipais);
        textMatricula.grabFocus();
        this.pessoa = null;
    }

    @Override
    public void mostraDadosObjeto() {
        textNome.setText(this.pessoa.getNome());
        textMatricula.setText(this.pessoa.getMatricula());
        textCPF.setText(this.pessoa.getCpf());
        comboBoxSexo.setSelectedIndex(0);
        if (!(this.pessoa.getSexo() == null) && !(this.pessoa.getSexo().isEmpty())) {
            comboBoxSexo.setSelectedItem(this.pessoa.getSexo());
        }
        formatTextDataNascimento.setText(this.pessoa.getDataNascimento());
    }

    /**
     * Verifica se todos campos estao vazio True todos campos estao vazio False
     * se existir campos nao vazios
     *
     * @return
     */
    private boolean verificaCamposVaziosSair() {
        if (!textNome.getText().isEmpty()) {
            return false;
        }

        return true;
    }
}
